package com.qfedu.util;

import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;

/**
 * 作者：刘随阳
 * 时间: 2021/9/20 9:47
 * 描述：神光照耀,太白成瑞。六丙来迎,百福悠归
 */
public class SMSUtil {

    public static void sendMsg(String phone,String code) throws ApiException {
        TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest",
                "23473071", "951efdcc9540d2c0c1646ed6d74892e6");
        AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
        req.setExtend("123456");
        req.setSmsType("normal");
        req.setSmsFreeSignName("问道学院");

        req.setSmsParamString("{\"code\":\""+code+"\"}");
        req.setRecNum(phone);
        req.setSmsTemplateCode("SMS_209190607");
        AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
        System.out.println(rsp.getBody());
    }
}
